import { defineStore, createPinia } from 'pinia';
// 持久化插件
import piniaPluginPersist from 'pinia-plugin-persist';

// 定义导出容器
export const useComponentStore = defineStore('component', {
	state: () => {
		return {
			activeByPage: null as any,
			activeIndex: null as any,
		};
	},
	getters: {

	},
	persist: {
		enabled: true,
		strategies: [
			{ key: 'activeByPage', paths: ['activeByPage'], storage: sessionStorage },
			{ key: 'activeIndex', paths: ['activeIndex'], storage: sessionStorage },
		]
	}
});

const pinia = createPinia().use(piniaPluginPersist);

export default pinia;
